<?php

namespace app\admin\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Mission extends Model
{
	protected $pk='mission_id';
    protected $json = ['money_cfg'];
    protected $jsonAssoc = true;


    public function description(){
        return $this->hasOne("mission_description",'mission_id',"mission_id");
    } 
    

    



	public function catInfo(){
        return $this->hasMany("cat_description",'cat_id',"cat_id");
    }


    public function userInfo(){
    	return $this->hasone("user",'u_id',"u_id");
    }


    public function contributes(){
         return $this->hasMany("mission_schedule",'mission_id',"mission_id");
    }


    /**
     * 合格投稿
     * @return [type] [description]
     */
    public function contributesEffect(){
         return $this->hasMany("mission_schedule",'mission_id',"mission_id")->where('status',3);
    }

    

    /**
     * 获取全部状态
     * @var [type]
     */
    public static function  getStatus($int=0){
        $res =  [
            1=>'待付款',
            2=>'待审核',
            3=>'进行中',
            4=>'完成',
            5=>'仲裁',   
            -1=>'已删除',   
        ];
        return $int>0 ? $res[$int]:$res;
    }

  




}
